package vl.scanfile.cmmn.json;

import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.servlet.view.AbstractView;

import vl.scanfile.cmmn.util.CmmUtil;

/**
 * ìŠ¤í”„ë§� ê¸°ë³¸ë‚´ìž¥ MappingJacksonJsonViewë¥¼ ëŒ€ì²´í•œ JsonView Class
 * <p>
 * dispatcherServlet ì„¤ì •íŒŒì�¼ì—� ë¹ˆìœ¼ë¡œ ë“±ë¡�í›„ ì‚¬ìš©<br>
 * 
 * new ModelAndView("jsonView", Map) <br>
 * í˜•ì‹�ìœ¼ë¡œ ì‚¬ìš©
 * 
 * @author moon9
 * @version 2014.02.10
 *
 */
public class MappingGsonJsonView extends AbstractView {
	
	/**
	 *  AbstractViewë¥¼ ìƒ�ì†�ë°›ì•˜ìœ¼ë¯€ë¡œ ê¸°ë³¸ ìƒ�ì„±ìž� ìž‘ì„±
	 */
	public MappingGsonJsonView() {
		super();
	}
	
	/**
	 *  {@link com.lo.cmmn.util.CmmUtil}ì—� ì„¤ì •ë�œ Gsonê°�ì²´ë¥¼ ì‚¬ìš©í•˜ì—¬ ê°�ì²´ë¥¼ jsoní˜•íƒœë¡œ ë³€ê²½í•œë‹¤.
	 *  @param model
	 *  	ë�°ì�´í„°ê°€ ë‹´ê¸´ ëª¨ë�¸ë§µ ê°�ì²´
	 *  @param req
	 *  	ìš”ì²­ë°›ì�€ {@link javax.servlet.http.HttpServletRequest} ê°�ì²´
	 *  @param res
	 *  	ì�‘ë‹µí•  {@link javax.servlet.http.HttpServletResponse} ê°�ì²´
	 */
	@Override
	protected void renderMergedOutputModel(Map<String, Object> model,
			HttpServletRequest req, HttpServletResponse res) throws Exception {
		
		res.setContentType( getContentType());
		res.getWriter().write( CmmUtil.getGsonInstance().toJson( model));

	}

}
